package zhtt.scheduler;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import zhtt.service.SyncDataService;

/**
 * Created by zhtt on 2016/10/29.
 */

@Lazy(false)
@Service
public class ZhttScheduler2 {

    @Autowired
    private SyncDataService syncDataService;

    /**
     * fixedDelay: 每120秒钟执行一次: 执行时间间隔从上一次执行结束算
     *
     */
    //@Scheduled(cron="0 0/20 10-20 * * ?")
    @Scheduled(fixedDelay = 8*1000)
    public void syncData(){
        syncDataService.sync("开始定时工作");
    }

}
